//
//  MyOrderTableViewHeaderFooterView.m
//  GLGW_Shoping
//
//  Created by yang on 2018/11/21.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "MyOrderTableViewHeaderFooterView.h"

@implementation MyOrderTableViewHeaderFooterView

-(instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
        GLGWView * bankgroundView = [[GLGWView alloc] initWithFrame:CGRectMake(0, -kHeightProportion_In_iPhoneTriploid(10), KScreenWidth, kHeightProportion_In_iPhoneTriploid(42)) inSuperView:self];
        bankgroundView.backgroundColor = [UIColor whiteColor];
        UIRectCorner type = UIRectCornerTopLeft | UIRectCornerTopRight;
        [bankgroundView setBorderWithCornerRadius:10.0 borderWidth:0 borderColor:[UIColor whiteColor] type:type];
        //
        GLGWView * lineView = [[GLGWView alloc] initWithInSuperView:bankgroundView];
        lineView.backgroundColor = [UIColor colorWithHexString:@"#EAEAEA"];
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.bottom.right.equalTo(bankgroundView).offset(0);
            make.height.equalTo(@1);
        }];
        //
        GLGWLabel * orderTitleLabel = [[GLGWLabel alloc] initWithFrame:CGRectMake(kWidthProportion_In_iPhoneTriploid(15), kHeightProportion_In_iPhoneTriploid(10), kWidthProportion_In_iPhoneTriploid(100), kHeightProportion_In_iPhoneTriploid(22)) theFont:BOLDSYSTEMFONT(16) theColor:kColor_Rule_Black inSuperView:bankgroundView];
        orderTitleLabel.text = @"我的订单";
        //
        GLGWImageView * pushImageView = [[GLGWImageView alloc] initWithImageName:@"icon_chakan" inSuperView:bankgroundView];
//        pushImageView.backgroundColor = kRandomColor;
        [pushImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(bankgroundView);
            make.right.equalTo(bankgroundView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(14)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(14)));
        }];
        //
        GLGWLabel * seeAllOrderLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:bankgroundView];
        seeAllOrderLabel.text= @"查看全部订单";
        seeAllOrderLabel.textAlignment = NSTextAlignmentRight;
        [seeAllOrderLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(pushImageView.mas_left).offset(-kWidthProportion_In_iPhoneTriploid(5));
            make.top.equalTo(bankgroundView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(13));
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(100)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(17)));
        }];
        //手势
        UITapGestureRecognizer * tap_Order = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap_OrderSelf:)];
        tap_Order.numberOfTouchesRequired = 1;
        tap_Order.numberOfTapsRequired = 1;
        [bankgroundView addGestureRecognizer:tap_Order];
        bankgroundView.userInteractionEnabled = YES;
    }
    return self;
}

-(void)tap_OrderSelf:(UITapGestureRecognizer *)tag{
    if (self.Block_OrderAction) {
        self.Block_OrderAction();
    }
}

@end
